﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using DnD.ViewModels;

namespace DnD
{
    public partial class UserPage : PhoneApplicationPage
    {
        public UserPage()
        {
            InitializeComponent();

            DataContext = new UserViewModel(this);
        }

        private void AppBar_Click(object sender, EventArgs e)
        {
            ((UserViewModel)DataContext).handleMenuRequest(((ApplicationBarIconButton)sender).Text);
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ((UserViewModel)DataContext).refreshUserData();
        }
    }
}